<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="http://www.petercorke.com/RVC/common/toolboxhelp.css">
    <title>M-File Help: ihist</title>
  </head>
  <body>
  <table border="0" cellspacing="0" width="100%">
    <tr class="subheader">
      <td class="headertitle">M-File Help: ihist</td>
      <td class="subheader-left"><a href="matlab:open ihist">View code for ihist</a></td>
    </tr>
  </table>
<h1>ihist</h1><p><span class="helptopic">Image histogram</span></p><p>
<span style="color:red">ihist</span>(<strong>im</strong>, <strong>options</strong>) displays the image histogram.  For an image with  multiple
planes the histogram of each plane is given in a separate subplot.

</p>
<p>
<strong>H</strong> = <span style="color:red">ihist</span>(<strong>im</strong>, <strong>options</strong>) is the image histogram as a column vector.  For
an image with multiple planes <strong>H</strong> is a matrix with one column per image plane.

</p>
<p>
[<strong>H</strong>,<strong>x</strong>] = <span style="color:red">ihist</span>(<strong>im</strong>, <strong>options</strong>) as above but also returns the bin coordinates as
a column vector <strong>x</strong>.

</p>
<h2>Options</h2>
<table class="list">
  <tr><td style="white-space: nowrap;" class="col1"> 'nbins'</td> <td>number of histogram bins (default 256)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1"> 'cdf'</td> <td>compute a cumulative histogram</td></tr>
  <tr><td style="white-space: nowrap;" class="col1"> 'normcdf'</td> <td>compute a normalized cumulative histogram, whose maximum value
is one</td></tr>
  <tr><td style="white-space: nowrap;" class="col1"> 'sorted'</td> <td>histogram but with occurrence sorted in descending magnitude
order.  Bin coordinates X reflect this sorting.</td></tr>
</table>
<h2>Example</h2>
<pre style="width: 90%%;" class="examples">
[h,x]&nbsp;=&nbsp;ihist(im);
bar(x,h);
</pre>
<pre style="width: 90%%;" class="examples">
[h,x]&nbsp;=&nbsp;ihist(im,&nbsp;'normcdf');
plot(x,h);
</pre>
<h2>Notes</h2>
<ul>
  <li>For a uint8 image the MEX function FHIST is used (if available)</li>
<ul>
  <li>The histogram always contains 256 bins</li>
  <li>The bins spans the greylevel range 0-255.</li>
</ul>
  <li>For a floating point image the histogram spans the greylevel range 0-1.</li>
  <li>For floating point images all NaN and Inf values are first removed.</li>
</ul>
<h2>See also</h2>
<p>
<a href="matlab:doc hist">hist</a></p>
<hr>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr class="subheader" valign="top"><td>&nbsp;</td></tr></table>
<p class="copy">&copy; 1990-2012 Peter Corke.</p>
</body></html>